<?php $this->load->helper('form'); 
//Programer note:	ID attributes used for client-side operations. (ID follows modular '_camelCase' control naming convention).
//Name attribute is used for Posting/Data operations.	(Name follows field name from database convention) 
?>
	<div style="float:left; width:100%;">
    <h1>Car Info</h1><br>
    <div style="float:left; margin-bottom: 5px;">
      <p>
        <?php echo '<a href="/index.php?/member_profile/">Return to profile</a>';?>
      </p>
	</div>
    <div style="clear:both;"></div>
	<?php 
		$hidden_fields	=	array('car_id' => $car_id);
		$attributes		=	array('id'=>'_carProfileForm');
		echo form_open('member_car/'.$save_type, $attributes, $hidden_fields);

		echo form_fieldset('','class = "general-info-fieldset"');?>
      <?php echo form_label('Nickname:', '_nickname');?>
				<input type="text" id="_nickname" name = "nickname" value="<?php echo set_value('nickname', $nickname); ?>" size="50" autocomplete="off" />
				<br class="clear" />
      <?php echo form_label('Year:', '_year');?>
				<input type="text" id="_year" name = "year" class="year-box" value="<?php echo set_value('year', $year); ?>" size="50" autocomplete="off" />
				<br class="clear" />
			<?php echo form_label('Owned from:', '_ownedFrom');?>
				<input type="text" id="_ownedFromDate" name = "owned_from" class="date-box editable hasDatePicker" value="<?php echo set_value('owned_from', $owned_from); ?>" size="50" autocomplete="off" />
				<br class="clear" />
			<?php echo form_label('Owned to:', '_ownedToDate');?>
				<input type="text" id="_ownedToDate" name = "owned_to" class="date-box editable hasDatePicker" value="<?php echo set_value('owned_to', $owned_to); ?>" size="50" autocomplete="off" />
				<br class="clear" />
      <?php echo form_label('Model:', '_carmodel');?>
			<?php echo form_dropdown('model_id', $model_lookup, $model_id, 'id = "_car_model" class="editable"'); //The 4th parameter is the js option?>
			<br class="clear" />
      <?php echo form_label('Engine:', '_car_engine');?>
			<?php echo form_dropdown('engine_id', $engine_lookup, $engine_id, 'id = "_car_engine" class="editable"'); //The 4th parameter is the js option?>
			<br class="clear" />
	<?php echo form_label('For Sale:', '_forSale');?>
					<?php echo form_checkbox($for_sale_checkbox);?>
					<br class="clear" />
		<?php echo form_label('Price:', '_price');?>
			<input type="text" id="_price" name = "price" class="editable currency-box" value="<?php echo set_value('price', $price); ?>" size="50" autocomplete="off" />
			<br class="clear" />
		<?php echo form_label('Notes:', '_notes');?>
			<textarea type="text" id="_notes" name = "notes" class="editable" autocomplete="off" rows="5" cols="60"><?php echo set_value('notes', $notes); ?></textarea>
			<br class="clear" />
            <div style="padding-left: 525px;">
                <input name="save" id="_save" class ="save-button" type="submit" value="<?php echo $save_type == 'new_car' ? 'Save' : 'Ok'; ?>"/>
            </div>
            
<?php echo form_fieldset_close(); ?>
			



<?php //If adding a car, then we don't need to upload photographs yet
	if ($save_type == 'new_car') {
		echo '</div>';
		echo '<div style="clear:both;"></div>';
		return; 
	}
?>


	
		<?php echo form_close(); ?>
        <h1>Upload Photograph</h1><br>

		<div class="info-message"><?php echo $upload_error;?></div>

		<?php echo form_open_multipart('member_car/do_upload/'.$car_id);?>

		<input type="file" name="userfile" size="20" />

		<br /><br />
		<input type="submit" value="Upload" />

		<?php echo form_close(); ?>
		<br class="clear" />
		<h1>Car Photos</h1><br>
		<?php echo $car_gallery;?>

</div>

<div style="clear:both;"></div>